﻿@model PagedList<kxcxw.Data.Entities.AnnouncementInfo>
@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/Admin/Views/Shared/_InfoLayout.cshtml";
}
<h2>
    @Html.ActionLink("公告管理", "Index") &raquo; @Html.ActionLink("公告列表", "Index", null, new { @class = "active" })</h2>
<div class="toolbar">
    @Html.ActionLink("创建公告", "Create", new { @class="add"})
</div>
<div id="main">
    <table>
        <tr>
            <th style="width:10%">
                所属类别
            </th>
            <th style="width:50%">
                内容
            </th>
            <th style="width:10%">
                发布人
            </th>
            <th style="width:9%">
                @Html.ActionLink("发布时间", "Index", new { sortOrder = ViewBag.DateSortParm })
            </th>
            <th style="width:18%">
                操作
            </th>
        </tr>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.SysItemDetial.itemDetialName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.AnnouncementContent)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.SysUserInfo.UserName)
                </td>
                <td>
                    @string.Format("{0:yyyy-MM-dd}", DateTime.Parse(@Html.DisplayFor(modelItem => item.CreateDate).ToString()))
                </td>
                <td>
                    @Html.ActionLink("修改", "Edit", new { id = item.AnnouncementID }, new { @class = "edit" })
                    |
                    @Html.ActionLink("查看", "Details", new { id = item.AnnouncementID }, new { @class = "edit" })
                    |
                    @Html.ActionLink("删除", "Delete", new { id = item.AnnouncementID }, new { @class = "edit" })
                </td>
            </tr>
        }
    </table>
    <p>
        共有 @Model.TotalItemCount 条记录 @Model.CurrentPageIndex/@Model.TotalPageCount</p>
    @Html.Pager(
 Model, new PagerOptions
 {
     PageIndexParameterName = "page",
     FirstPageText = "首页",
     LastPageText = "尾页",
     NextPageText = "后一页",
     PrevPageText = "前一页",
     ShowPageIndexBox = true,
     PageIndexBoxType = PageIndexBoxType.TextBox,
     PageIndexBoxWrapperFormatString = "请输入页数{0}"
 }, "Admin_default",
            new { sortOrder = ViewBag.DateSortParm, searchString = ViewBag.Filter }
    )
</div>
<script type="text/jscript">
    $(function () {
        $(".delete").click(function () {
            if (confirm("确定要删除这条记录么？")) {
                alert("删除成功");
            }
            else {
                return false;
            }
        });
    }); 
</script>
